<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>陪护订单</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/newWeb/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/newWeb/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/newWeb/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/newWeb/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/newWeb/css/order.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row m-t-sm animated fadeInUp">
            <div class="col-sm-12">
                <div class="ibox">
                    <div class="ibox-title">
                        <h5>订单列表</h5>
                        <div class="ibox-tools">
                            <a href="addOrder.html" class="btn btn-primary btn-xs">新增订单</a>
                        </div>
                    </div>
                    <form id="mainForm" action="__ACTION__" method="post">
                        <input type="hidden" name="attend_type" value="{$attend_type}">
                        <div class="ibox-content">
                            <div class="btn-group orderStatusTab">
                                <button class="btn <if condition="$Think.POST.order_status eq '0'">btn-info<else/>btn-white</if>" type="button" value="0">待支付</button>
                                <button class="btn <if condition="$Think.POST.order_status eq '1'">btn-info<else/>btn-white</if>" type="button" value="1">待确认</button>
                                <button class="btn <if condition="$Think.POST.order_status eq '2'">btn-info<else/>btn-white</if>" type="button" value="2">待陪护</button>
                                <button class="btn <if condition="$Think.POST.order_status eq '3'">btn-info<else/>btn-white</if>" type="button" value="3">陪护中</button>
                                <button class="btn <if condition="$Think.POST.order_status eq '4'">btn-info<else/>btn-white</if>" type="button" value="4">已完成</button>
                                <button class="btn <if condition="$Think.POST.order_status eq '-2'">btn-info<else/>btn-white</if>" type="button" value="-2">已取消</button>
                                <button class="btn <if condition="$Think.POST.order_status eq ''">btn-info<else/>btn-white</if>" type="button" value="">全部</button>
                            </div>
                            <input type="hidden" name="order_status" value="{$Think.POST.order_status}">
                            <input type="hidden" name="pay_status">
                            <div class="row m-b-md m-t-md search-form">
                                <div class="col-md-3 order-time">
                                    <input placeholder="开始时间" class="form-control layer-date" id="start" name="start_time" value="{$Think.POST.start_time}">
                                    <input placeholder="结束时间" class="form-control layer-date" id="end" name="end_time" value="{$Think.POST.end_time}">
                                </div>
                                <div class="col-md-2">
                                    <select class="form-control" name="pay_status">
                                        <option>请选择支付方式</option>
                                        <option value='0' <if condition="$Think.POST.pay_status eq '0'">selected</if>>未支付</option>
                                        <option value='1' <if condition="$Think.POST.pay_status eq '1'">selected</if>>已支付</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <select class="form-control" name="order_type">
                                        <option>请选择订单来源</option>
                                        <option value='1' <if condition="$Think.POST.order_type eq '1'">selected</if>>线上</option>
                                        <option value='2' <if condition="$Think.POST.order_type eq '2'">selected</if>>线下</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <select class="form-control" name="pay_type">
                                        <option>请选择支付方式</option>
                                        <option value='1' <if condition="$Think.POST.pay_type eq '1'">selected</if>>微信支付</option>
                                        <option value='4' <if condition="$Think.POST.pay_type eq '4'">selected</if>>POS机</option>
                                        <option value='3' <if condition="$Think.POST.pay_type eq '3'">selected</if>>现金</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <input type="text" value="{$Think.POST.keyword}" placeholder="请输入搜索内容" class="form-control" name="keyword">
                                </div>
                                <div class="col-md-1">
                                    <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                            <div class="project-list">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>支付状态</th>
                                        <th>订单编号</th>
                                        <th>订单状态</th>
                                        <th>护理对象</th>
                                        <th>联系电话</th>
                                        <th>服务类型</th>
                                        <th>订单来源</th>
                                        <th>下单时间</th>
                                        <th>服务时间</th>
                                        <th>支付方式</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody class='order-detail'>
                                    <foreach name="orderList" item="vo" key="k" >
                                        <tr>
                                            <td class="project-status">
                                                <switch name="vo.pay_status">
                                                    <case value="0"><span class="label label-primary">待支付</case>
                                                    <case value="1"><span class="label label-success">已支付</case>
                                                    <default />未知
                                                </switch>
                                            </td>
                                            <td class="project-num">
                                                {$vo.order_number}
                                            </td>
                                            <td class="project-num">
                                                <switch name="vo.order_status">
                                                    <case value="0">待支付</case>
                                                    <case value="1">待确认</case>
                                                    <case value="2">待陪护</case>
                                                    <case value="3">陪护中</case>
                                                    <case value="4">已完成</case>
                                                    <case value="-1">支付超时</case>
                                                    <case value="-2">已取消</case>
                                                    <default />未知
                                                </switch>
                                            </td>
                                            <td class="project-name">
                                                {$vo.truename}
                                            </td>
                                            <td class="project-phone">
                                                {$vo.mobile}
                                            </td>
                                            <td class="project-type">
                                                住院陪护-普通陪护<br/>可自理
                                            </td>
                                            <td class="project-from">
                                                <switch name="vo.order_type">
                                                    <case value="1">线上</case>
                                                    <case value="2">线下</case>
                                                    <default />未知
                                                </switch>
                                            </td>
                                            <td class="project-from">
                                                {$vo.created_time|date="Y-m-d:H:i",###}
                                            </td>
                                            <td class="project-time">
                                                {$vo.begin_time|date="Y-m-d",###}<br/>至{$vo.end_time|date="Y-m-d",###}
                                            </td>
                                            <td class="project-time">
                                                <if condition="$vo['pay_status'] eq 1">
                                                    <switch name="vo.pay_type">
                                                        <case value="1">微信</case>
                                                        <case value="2">支付宝</case>
                                                        <case value="3">现金</case>
                                                        <case value="4">POS机</case>
                                                        <default />未知
                                                    </switch>
                                                </if>
                                            </td>
                                            <td class="project-actions">
                                                <a href="__CONTROLLER__/orderDetail/id/{$vo.id}" class="btn btn-white btn-sm"><i class="fa fa-folder"></i> 查看 </a>
                                            </td>
                                        </tr>
                                    </foreach>
                                    </tbody>
                                </table>
                                <div class="page row">
                                    {$page}
                                </div>
                                <!--<div class="row">
                                    <div class="dataTables_paginate paging_simple_numbers" style="float: right;margin: 0;">
                                        <ul class="pagination">
                                            <li class="paginate_button previous disabled" aria-controls="DataTables_Table_0" tabindex="0" id="DataTables_Table_0_previous">
                                                <a href="#">上一页</a>
                                            </li>
                                            <li class="paginate_button active" aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">1</a>
                                            </li>
                                            <li class="paginate_button " aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">2</a>
                                            </li>
                                            <li class="paginate_button " aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">3</a>
                                            </li>
                                            <li class="paginate_button " aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">4</a>
                                            </li>
                                            <li class="paginate_button " aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">5</a>
                                            </li>
                                            <li class="paginate_button " aria-controls="DataTables_Table_0" tabindex="0">
                                                <a href="#">6</a>
                                            </li>
                                            <li class="paginate_button next" aria-controls="DataTables_Table_0" tabindex="0" id="DataTables_Table_0_next">
                                                <a href="#">下一页</a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>-->
                            </div>
                        </div>
                    </form>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="__PUBLIC__/newWeb/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/newWeb/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/newWeb/js/plugins/layer/laydate/laydate.js"></script>
    <script>
        $(document).ready(function(){
            $(".search-form select").on("change",function(){
                changeColor($(this));
            })
            $(".search-form select").each(function(){
                changeColor($(this));
            })
            function changeColor(el){
                el.val()==0 ? el.addClass("no-select") : el.removeClass("no-select");
            }

            // 订单状态切换
            $(".orderStatusTab button").click(function(){
                $(this).removeClass("btn-white").addClass("btn-info");
                $(this).siblings().addClass("btn-white").removeClass("btn-info");
            })

             //日期范围限制 
             var start = { 
                 elem: '#start', 
                 format: 'YYYY/MM/DD', 
                 istime: true, istoday: false, choose: function (datas) { 
                     end.min = datas; 
                     end.start = datas; 
                     } 
                }; 
                var end = { 
                    elem: '#end', 
                    format: 'YYYY/MM/DD', 
                    min: laydate.now(), 
                    istime: true, 
                    choose: function (datas) { 
                        start.max = datas; 
                        } 
                    }; 
                laydate(start);
                laydate(end);
        });
    </script>
    <script>
        $(document).ready(function () {
            $(".btn-group.orderStatusTab").find('button').on('click',function (event) {
                var status = $(event.target).val();
                $("input[name=order_status]").val(status);
                $("#mainForm").submit();
            })
            $(".page a").click(function (event) {
                var form = $("#mainForm");
                form.attr('action',$(event.target).attr('href'));
                form.submit();
                return false;
            })
        });
    </script>
</body>